package com.yangweiye.communicationonline;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author Lete
 * @乐特的程序永无BUG
 * @createDate 2020- 07-04 22:13
 *
 * 1. SendThread 发送消息线程
 * 2. RecieveThread 接受消息线程
 */
public class Server {
    public static void main(String[] args) {
        try {

            // 监听8888端口
            ServerSocket ss = new ServerSocket(8888);

            System.out.println("监听在端口号:8888");
            Socket s = ss.accept();

            //启动发送消息线程
            new SendThread(s).start();
            //启动接受消息线程
            new RecieveThread(s).start();

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}
